//
//  UILabel+Convenient.m
//  链式编程
//
//  Created by apple on 2017/9/4.
//  Copyright © 2017年 apple. All rights reserved.
//

#import "UILabel+Convenient.h"

@implementation UILabel (Convenient)

- (UILabel *(^)(NSString *))wt_text{

    return ^(NSString *value){
        
        self.text = value;
        
        return self;
    };
}

- (UILabel *(^)(int ))wt_font{

    return ^(int fontValue){
    
        self.font = [UIFont systemFontOfSize:fontValue];
        
        return self;
    };
}


- (UILabel *(^)(NSString *, int))wt_fontType{
    
    return ^(NSString *fontType, int fontSize){
        
        self.font = [UIFont fontWithName:fontType size:fontSize];
        
        return self;
    };
}


- (UILabel *(^)(int, int, int))wt_textColor{

    return ^(int R, int G, int B){
    
        self.textColor = [UIColor colorWithRed:R/255.0 green:G/255.0 blue:B/255.0 alpha:1];
        
        return self;
    };
}


- (UILabel *(^)(int, int, int))wt_bgColor{
    
    return ^(int R, int G, int B){
        
        self.backgroundColor = [UIColor colorWithRed:R/255.0 green:G/255.0 blue:B/255.0 alpha:1];
        
        return self;
    };
}


- (UILabel *(^)(NSString *))wt_textAlignment{

    return ^(NSString *alignment){
        
        if ([alignment isEqualToString:@"L"]) {
            
            self.textAlignment = NSTextAlignmentLeft;
            
        }else if ([alignment isEqualToString:@"R"]){
        
            self.textAlignment = NSTextAlignmentRight;
            
        }else{
        
            self.textAlignment = NSTextAlignmentCenter;
        }
        
        return self;
    };
}

@end
